package com.kayden.mybatis.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.kayden.mybatis.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserInfoMapper extends BaseMapper<UserInfo> {


    @Select("select * from user_info where id = #{id}")
    UserInfo selectById2(Integer id);

    UserInfo selectById3(Integer id);

    @Select("select id ,username,password,age from user_info ${ew.customSqlSegment}")
    List<UserInfo> selectUserInfoByCondition(@Param(Constants.WRAPPER)Wrapper<UserInfo> queryWrapper);

    @Update("update user_info set age = age +#{addAge} ${ew.customSqlSemgent}")
    Integer updateById2(Integer addAge,@Param(Constants.WRAPPER) Wrapper<UserInfo> queryWrapper);

}
